diff options
| author | Adam Soltys <[email protected]> | 2024-12-21 10:24:04 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-12-21 10:24:09 -0800 |
| commit | e2fcfdc4d608e260bb596952d8b54a7dcef05258 (patch) | |
| tree | 5d30171f8396443521bbd396655c17fc33e1cccd /src/routes/(app)/send/invoice/[id]/+page.server.ts | |
| parent | 1432e4d15849439cccdcb37426a8ec466b6af131 (diff) | |
| download | coinos-ui-e2fcfdc4d608e260bb596952d8b54a7dcef05258.tar.gz coinos-ui-e2fcfdc4d608e260bb596952d8b54a7dcef05258.zip | |
send max for internal payments
Diffstat (limited to 'src/routes/(app)/send/invoice/[id]/+page.server.ts')
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 6cacc1c6..c78ba008 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -3,8 +3,8 @@ import { auth, fd, get, post, types } from "$lib/utils"; import { error, redirect } from "@sveltejs/kit"; export async function load({ cookies, params: { id }, parent }) { - const aid = cookies.get("aid"); const { user } = await parent(); + const aid = cookies.get("aid") || user.id; const invoice = await get(`/invoice/${id}`); @@ -24,8 +24,9 @@ export async function load({ cookies, params: { id }, parent }) { const rates = await getRates(); const rate = rates[user.currency]; const invoiceRate = rates[invoice.currency]; + const { balance } = await get(`/account/${aid}`, auth(cookies)); - return { invoice, user, rate, invoiceRate }; + return { balance, invoice, user, rate, invoiceRate }; } export const actions = { |
